$(function(){
	
	// Setup All Ajax Calls
	$.ajaxSetup({
		beforeSend: function(){
			$("body>.throbber").slideDown(300);
		},
		complete: function(req){
			$("body>.throbber").slideUp(100);
		},
		success: function(response){
			$("#main-content").html(response);
		}
	});
	
	// Throbber position set
	$(window).resize(setThrobberPosition);
	setThrobberPosition();
});

function Request(options){
	if(!options.url){
		return;
	}
	
	options.url += "/ajax:1";
	
	$.ajax(options);
}

function setThrobberPosition(){
	$("body>.throbber").css({
		left: Math.round(($(window).width()-$("body>.throbber").width())/2)
	});
};